import { useRef, forwardRef } from 'react';
const Head = forwardRef(function Head(props, ref) {
  return (
    <div>
      <input type="text" ref={ref}></input>
    </div>
  );
});
function App() {
  const refHead = useRef(null);
  // 所以要改为，有记忆功能的ref
  const handleClick = () => {
    refHead.current.focus();
    refHead.current.style.background = '#ff0';
  };
  return (
    <div>
      hello App
      <button onClick={handleClick}>forwardRef操作</button>
      <br />
      <Head ref={refHead}></Head>
    </div>
  );
}
export default App;
